CopyRes is a XCMD allowing to copy resources between two files. Unlike ResCopy, it doesn't simply replace existing resources with same name or ID without warning, and offers a wide range of error checking.
SYNTAX
-------
CopyRes <prov file>,<dest file>,<res type>,<res name or ID>[,<I | R | K>]
PARAMETERS
------------
Prov and dest file can be name or full pathname. With a single name, the file is assumed to be in the same folder than the current stack. Using "*" for any of these parameters will refer to the current stack pathname.
Res type must be a four char string, and is case sensitive.
The resource to copy can be invoked by its name or its ID.
Last parameter is optionnal, and can be any string beginning with "I", "R" or "K". Its allows to automatically renumber the copied resource, either Incremental or Random. Incremental will set an ID equal to the highest ID of the type plus one. Random will set any ID no already existing and over 1000. Using "K" (Krunch) will not ask what to do with existing resource having same name or ID and simply replace it.
Using "!" and "?" parameter will return an online help (resp. copyright and syntax).
USING
-----
In case of name or ID conflict, the XCMD will bring an ask dialog allowing to rename or renumber the resource to copy. Renumbering dialog proposes another non-existing ID. Clicking Cancel will abort the copy.
If the same name or ID is kept, then a second answer dialog pops to get confirmation for replacing the previous resource. Clicking Yes replaces the resource, No returns to first dialog and Cancel aborts the copy.
If the copy succeeds, The Result will return a two items string containing the name and ID of the copied resource.
If any error occurs, or the copy is aborted, the Result can return :
"Error : Missing Parameter(s)"
"Error : Param 5 must begin with R,I or K"
"Error : Bad Resource Type"
"Error : Same dest and prov file"
"Error : Volume Not Found"
"Error : File Not Found"
"Error : Path Not Found"
"Error : Unknown #xx"
"Error : Resource not found"
"Error : Copy failed"
"Error : Copy aborted"
HISTORY
--------
1.9 : 12/25/91
• Added file alias handling
1.8 :
• Added "K" param
1.7 :
• Changed DetachResource to HandtoHand to avoid errors with HC 2.0.
This (these) external(s) is (are) FreeWare,allowing unlimited use in any non-commercial stack. You just need in this case to mention the author's name and copyright in your stack.
Any commercial use must be licensed and aknowledged by the author.